package April.fourteen;

import java.util.LinkedList;

/*
调用LinkedList 的删除开头和结尾的自己的方法时
 不可以多态调用
 */
public class LinkedListDemo {
    public static void main(String[] args) {
        function_2();
    }
/*
  练习remove方法
 */
    public static void function_2(){
        LinkedList<Integer> ink = new LinkedList<Integer>();
        ink.add(1);
        ink.add(2);
        ink.add(3);
        ink.add(4);
        int j = ink.removeFirst();
        System.out.println(j);
        System.out.println(ink);
        int k = ink.removeLast();
        System.out.println(k);
        System.out.println(ink);
    }
    /*
    练习 LinkedList 增加开头方法
     */
    public static void function_1(){
        LinkedList<String> ink = new LinkedList<String>();
        ink.add("1");
        ink.add("2");
        ink.add("3");
        ink.add("4");
        ink.addFirst("5");
        System.out.println(ink);
        ink.addLast("a");
        ink.addLast("b");
        ink.addLast("c");
        ink.addLast("d");
        System.out.println(ink);
    }

}
